package com.lx.chong.model;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * @author: chong
 * @date: 2018/8/23
 * @tableName: 部门表
 */
@Entity
@Data
@ToString
@NoArgsConstructor
@AllArgsConstructor
public class Department implements Serializable {

    private static final long serialVersionUID = 7122784054469372784L;

    /**
     * 唯一标识符
     */
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "Id")
    private Long id;

    /**
     * 部门名称
     */
    @Column(name = "Name")
    private String name;

    /**
     * 上级部门
     */
    @ManyToOne(fetch = FetchType.EAGER, optional = true)
    @JoinColumn(name = "ParentId", insertable = true, unique = false)
    private Department department;

    /**
     * 添加时间
     */
    @Column(name = "AddDateTime")
    private Date addDateTime;

    /**
     * 修改时间
     */
    @Column(name = "UpdateDateTime")
    private Date updateDateTime = new Date();

    /**
     * 删除标志位(0：未删除；1：删除)
     */
    @Column(name = "IfDelete")
    private Integer ifDelete = 0;

    /**
     * 启用禁用状态(0：禁用；1：启用)
     */
    @Column(name = "UseMark")
    private Integer useMark;

    /**
     * 部门code
     */
    @Column(name = "Code")
    private String code;
}
